package com.swedne.test.udp;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;

public class ReceiverClient {
    public static void main(String[] args) {

        byte[] data = new byte[128 * 1024];

        try {
            DatagramSocket ds = new DatagramSocket(8400);
            while (true) {
                Thread.sleep(2000);
                System.out.println("receiver success runnint");
                DatagramPacket dp = new DatagramPacket(data, data.length);
                ds.receive(dp);
                String s = new String(dp.getData());
                System.out.println("receiver success" + s);
            }
        } catch (IOException e) {
            e.printStackTrace();
            System.out.println("receiver success IOException");
            return;
        } catch (InterruptedException e) {
            e.printStackTrace();
            System.out.println("receiver success InterruptedException");
            return;
        }
    }
}
